﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Model;
using System.Data.SqlClient;
using Db;

namespace BiffenServiceLibrary
{
    [DataContract]
    public class Service : IService
    {
        EmployeeDb employeeDb = new EmployeeDb();
        MovieDb movieDb = new MovieDb();

        public int DialServiceUp()
        {
            return 1;
        }

        // Movie
        public List<Movie> GetAllMovies()
        {
            return movieDb.GetAllMovies();
        }

        public List<Movie> GetAllActiveMovies()
        {
            return movieDb.GetAllActiveMovies();
        }

        public Movie GetMovieByID(int id)
        {
            return movieDb.GetMovieByID(id);
        }

        public List<Movie> FindMoviesByTitle(string title)
        {
            return movieDb.FindMoviesByTitle(title);
        }

        public int CreateMovie(Movie movie)
        {
            return movieDb.CreateMovie(movie);
        }

        public int UpdateMovie(Movie movie)
        {
            return movieDb.UpdateMovie(movie);
        }

        public void DeleteMovie(int movID)
        {
            movieDb.DeleteMovie(movID);
        }

        public List<Event> FindEvent(string title, string instructor, string actor, string duration, string playtime, List<string> genres)
        {
            return movieDb.FindEvent(title, instructor, actor, duration, playtime, genres);
        }

        // Employee
        public Employee GetEmployeeById(int id)
        {
            return employeeDb.GetEmployeeById(id);
        }

        // Member
        MemberDb memberdb = new MemberDb();

        public Member GetMemberByID(int id)
        {
            return memberdb.GetMemberById(id);
        }

        public Member GetMemberByName(string fname, string lname)
        {
            return memberdb.GetMemberByName(fname, lname);
        }

        public int CreateMember(Member newMember)
        {

            return memberdb.CreateMember(newMember);


        }

        public Boolean UpdateMember(Member updatedMember)
        {
           return memberdb.UpdateMember(updatedMember);
        }

        public Boolean DeleteMember(int id)
        {
            return memberdb.DeleteMember(id);
        }

        public List<Member> GetAllMembers()
        {
            return memberdb.GetAllMembers();
        }

        public List<Genre> GetAllGenres()
        {
            return movieDb.GetAllGenres();
        }
    }
}
